Skip to content

[fix] skip _align_special_tokens during training. - #188

Merged
liu-zichen merged 2 commits into
alibaba:mainfrom
Kuangdd01:patch_cfg
Oct 11, 2025
Merged

[fix] skip _align_special_tokens during training.#188
liu-zichen merged 2 commits into
alibaba:mainfrom
Kuangdd01:patch_cfg

Conversation

@Kuangdd01

@Kuangdd01 Kuangdd01 commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

In the recent transformers versions, e,g. >= 4.56.0 , _align_special_tokens(self) is introduced to check the model special token with the tokenizer configuration during training.
But McaModelConfig does not have these attributes. So mcatrainer failed in the process. In order to match this, this PR patches these attributes.

@CLAassistant

CLAassistant commented Oct 10, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@liu-zichen

Copy link
Copy Markdown
Collaborator

Thanks for this PR. It certainly addresses the compatibility issue with the _align_special_tokens method in newer versions of the Trainer.

However, I've observed that for the the aligned special tokens are not subsequently saved to the hf_config_json. As a result, the operation is performed, but its outcome is never used.

Therefore, I'd like to suggest two alternative paths forward:

  1. Skip the execution of _align_special_tokens altogether for mcore_adapter (by overriding it in mcore_adapter's Trainer), since it's currently ineffective.
  2. Or, make the function truly effective by modifying the logic to ensure the aligned tokens are correctly persisted in the hf_config_json.

@Kuangdd01

Kuangdd01 commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

Agree with you, _align_special_tokens only affects generation_config, which we don't really need for now.
Prefer the method1 :).

@Kuangdd01 Kuangdd01 changed the title [fix] patch special tokens [fix] skip _align_special_tokens during training. Oct 10, 2025
@liu-zichen

Copy link
Copy Markdown
Collaborator

LGTM!

@liu-zichen
liu-zichen merged commit d3af38d into alibaba:main Oct 11, 2025
2 checks passed
@tt0718

tt0718 commented Dec 5, 2025

Copy link
Copy Markdown

@Kuangdd01 👋hello from ROLL!感谢您对我们的关注和贡献
🤝ROLL期待和社区开发者建立更多的联系,共建交流,一起进步!后续项目也会组织定期的活动、给活跃用户发放礼品等
📧欢迎添加我的微信进一步沟通:tt19960718tt
如果您没有微信,也可以通过邮箱联系:tangtang.tt@alibaba-inc.com

👋 Hello from ROLL! Thank you for your interest and contributions to our project!
🤝 We at ROLL are eager to build stronger connections with our community developers. Let's foster collaboration and grow together! Looking ahead, the ROLL project will also organize regular events and offer gifts to active contributors.
📧 For further discussion:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants